package tester.input;

/**
 * This is the TesterMessage specific type enum
 * @author Caleb Chan
 *
 */
public enum TesterMessageType{
	
	// Used as inputs
	CreateElevatorMessage(0xFE),
	CreateDelayMessage(0xFD),
	DestroyElevatorMessage(0xFC)
	;
	
	private byte identifier;
    
	/**
	 * The constructor of each enum
	 * @param identifier The identifier for each enum
	 */
    private TesterMessageType(int identifier)
    {
        this.identifier = (byte) identifier;
    }
    
    /**
     * This method will return the identifier for an enum
     * @return Returns the identifier for an enum
     */
    public byte getIdentifier()
    {
        return identifier;
    }
    
    /**
     * This method will convert an type identifier to the TesterMessageType
     * @param identifier
     * @return
     */
    public static TesterMessageType getMessageTypeForId(byte identifier)
    {
        for (TesterMessageType t : TesterMessageType.values())
        {
            if (identifier == t.getIdentifier())
            {
                return t;
            }
        }
        
        return null;
    }
}
